﻿namespace Sidvall.Office
{
	public struct WorksheetCellPosition
	{
		#region Public Members

		#region RowIndex

		private int _RowIndex;
		public int RowIndex
		{
			get
			{
				return _RowIndex;
			}
			set
			{
				_RowIndex = value;
			}
		}

		#endregion
		#region ColumnIndex

		private int _ColumnIndex;
		public int ColumnIndex
		{
			get
			{
				return _ColumnIndex;
			}
			set
			{
				_ColumnIndex = value;
			}
		}

		#endregion

		#region Value object overrides

		public override int GetHashCode()
		{
			return _RowIndex ^ _ColumnIndex;
		}
		public override bool Equals(object obj)
		{
			if (!(obj is WorksheetCellPosition))
				return false;
			return Equals((WorksheetCellPosition)obj);
		}
		public bool Equals(WorksheetCellPosition other)
		{
			if (_RowIndex != other._RowIndex)
				return false;
			return _ColumnIndex == other._ColumnIndex;
		}
		public static bool operator ==(WorksheetCellPosition point1, WorksheetCellPosition point2)
		{
			return point1.Equals(point2);
		}
		public static bool operator !=(WorksheetCellPosition point1, WorksheetCellPosition point2)
		{
			return !point1.Equals(point2);
		}

		#endregion

		#endregion
		#region Constructors

		public WorksheetCellPosition(int rowIndex, int columnIndex)
		{
			_RowIndex = rowIndex;
			_ColumnIndex = columnIndex;
		}

		#endregion
	}
}
